package com.puzzlebazar.client.main.model;

import java.util.HashMap;

public abstract class PuzzleListInfoImpl implements PuzzleListInfo {
	
	public enum ListType {
		ALL_PUZZLES,
		PLAYABLE_PUZZLES, 
		EDITABLE_PUZZLES,
		VIEWABLE_TUTORIALS,
		EDITABLE_TUTORIALS
	}
	
	private static final String LIST_INFO_TYPE = "InfoType";
	
	/**
	 * Extract the type of a PuzzleListInfo given its list of parameters
	 * 
	 * @param params The list of parameters for the puzzle list info (will be modified, the type will be removed)
	 * @return The extracted type, or null if the parameters do not contain a type
	 */
	public static String extractInfoType( HashMap<String,String> params ) {
		return params.remove( LIST_INFO_TYPE );
	}
	

	private final String infoType;	
	private final HashMap<String,String> params = new HashMap<String,String>();
	
	/**
	 * Create a structure that can be used to describe a puzzle list
	 * 
	 * @param infoType The type of this puzzle list information structure
	 */
	protected PuzzleListInfoImpl( String infoType ) {
		this.infoType = infoType;
		params.put( LIST_INFO_TYPE, infoType );
	}

	/**
	 * Subclasses should call this in their constructor to append any class-specific parameters
	 *
	 * @param param The name of the parameter
	 * @param value The parameter value
	 */
	protected void appendCustomParam(String param, String value) {
		params.put( param, value );
	}

	public final String getType() {
		return infoType;
	}
	
	public final HashMap<String,String> getParams() {
		return params;		
	}
	
}
